package offer.singleton;

/**
 * Description：
 * Author: zhangc
 * Date：2017/7/18 9:34
 */
public class StaticClassSingleton {

    private static  int val = 0;

    private StaticClassSingleton(){}

    public  static StaticClassSingleton getInstance(){
        return SingletonHolder.singleton;
    }

    private static final class SingletonHolder{
        private static final StaticClassSingleton singleton = new StaticClassSingleton();
    }

    public int addVal(){
        return ++val;
    }

}
